package com.safety51.bootstrap.demo.domain.student;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by liuyuancheng on 2021/9/3  <br/>
 *
 * @author liuyuancheng
 */
@Service
@Slf4j
public class JdbcTemplateService {

    @Autowired
    @Qualifier(value = "jdbcTemplateOne")
    private JdbcTemplate jdbcTemplateOne;

    public void queryAllStudent() throws SQLException {
        List studentList = jdbcTemplateOne.queryForList("select id from student;",Integer.class);
        System.out.println(studentList);
//        System.out.println(dataSourceOne.getConnection());
//        jdbcTemplate.execute("select * from student");
    }
}
